package com.hilon.segment.mybatis.service.impl;

import com.hilon.segment.mybatis.service.AuthenticationFacadeService;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

@Service
public class AuthenticationFacadeServiceImpl implements AuthenticationFacadeService {
    /**
     * 通过spring security 自带的机制获取当前用户的信息.
     * @return 当前用户的信息
     */
    @Override
    public Authentication getAuthentication() {
        return SecurityContextHolder.getContext().getAuthentication();
    }
}
